﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Brain.Rendering
{
    public class FrustumCullingManager : ICuller
    {
        public bool ShouldDraw(ICamera3D Camera, BrainModelMesh mesh, IWorldObject world)
        {
            BoundingSphere final = mesh.BoundingSphere;
            final.Center = world.Position;
            final.Radius *= Vector3Util.Average(world.Scale);

            if (Camera.Frustum.Intersects(final))
            {
                return true;
            }
            return false;
        }


        public bool ShouldDraw(BoundingFrustum Frustum, BrainModelMesh mesh, IWorldObject world)
        {
            BoundingSphere final = mesh.BoundingSphere;
            final.Center = world.Position;
            final.Radius *= Vector3Util.Average(world.Scale);

            if (Frustum.Intersects(final))
            {
                return true;
            }
            return false;
        }


        public bool ShouldDraw(ICamera3D Camera, ModelMesh mesh, IWorldObject world)
        {
            BoundingSphere final = mesh.BoundingSphere;
            final.Center = world.Position;
            final.Radius *= Vector3Util.Average(world.Scale);

            if (Camera.Frustum.Intersects(final))
            {
                return true;
            }
            return false;
        }

        public bool ShouldDraw(BoundingFrustum Frustum, ModelMesh mesh, IWorldObject world)
        {
            BoundingSphere final = mesh.BoundingSphere;
            final.Center = world.Position;
            final.Radius *= Vector3Util.Average(world.Scale);

            if (Frustum.Intersects(final))
            {
                return true;
            }
            return false;
        }
    }
}
